UNPKG

marko

Version:

UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.

18 lines (14 loc) 474 B
import { types as t } from "@marko/compiler"; import write from "../util/html-out-write"; import withPreviousLocation from "../util/with-previous-location"; const ieConditionalCommentRegExp = /^\[if |<!\[endif\]$/; export default function (path) { const { node } = path; if (ieConditionalCommentRegExp.test(node.value)) { path.replaceWith( withPreviousLocation(write`<!--${t.stringLiteral(node.value)}-->`, node), ); } else { path.remove(); } }